package com.longcai.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.longcai.entity.sys.SysPermission;
import com.longcai.mapper.SysPermissionMapper;
import com.longcai.service.SysPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author ZJ
 * @since 2019-03-16
 */
@Service
public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements SysPermissionService {

    @Autowired
    private SysPermissionMapper sysPermissionMapper;

    @Override
    public List<SysPermission> listParents() {
        return this.sysPermissionMapper.listParents();
    }

    @Override
    public SysPermission getById(Integer id) {

        return this.sysPermissionMapper.selectById(id);
    }

    @Override
    public void updatePermission(SysPermission sysPermission) {
        this.sysPermissionMapper.updateById(sysPermission);
    }

    @Override
    public List<SysPermission> listByRoleId(Integer roleId) {
        return this.sysPermissionMapper.listByRoleId(roleId);
    }
}
